package servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;

import Model.CommitteeRole;
import Model.Staff;

/**
 * Servlet implementation class CommitteeRolesDropdown
 */

public class CommitteeRolesDropdown extends HttpServlet {
	private static final long serialVersionUID = 1L;
	JspWriter out;
	String committeeRoleId;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public CommitteeRolesDropdown() {
		super();
		// TODO Auto-generated constructor stub
	}

	public CommitteeRolesDropdown(JspWriter outputStream, String id) {
		// TODO Auto-generated constructor stub
		out = outputStream;
		committeeRoleId = id;
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		javax.servlet.http.HttpSession session = request.getSession();
		String currentUser = session.getAttribute("username").toString();

		ArrayList<CommitteeRole> roleTable = new ArrayList<CommitteeRole>();
		roleTable = Database.CommitteeRoleDB.getCommitteeRole(committeeRoleId);

		for (int i = 0; i < roleTable.size(); i++) {
			out.print("<option value='" + roleTable.get(i).getName() + "'>");
			out.print(roleTable.get(i).getName());
			out.print("</option>");
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
